int main() { Example e; std::cout << "End of main\n"; return 0; }
---
ОТВЕТ: Constructing t1 Constructing temp1 Constructing temp2 Inside constructor Constructing t2 End of main Destructing t2 Destructing temp2 Destructing temp1 Destructing t1
---
Почему так:
• Поля инициализируются в порядке объявления в структуре, а не в списке инициализации • std::initializer_list создаёт временные объекты, которые копируются в вектор • t2 создаётся после строки Inside constructor • Деструкторы вызываются в обратном порядке: t2 → temp2 → temp1 → t1
Хитрость — в порядке инициализации, временных объектах и destructuring-порядке!
int main() { Example e; std::cout << "End of main\n"; return 0; }
---
ОТВЕТ: Constructing t1 Constructing temp1 Constructing temp2 Inside constructor Constructing t2 End of main Destructing t2 Destructing temp2 Destructing temp1 Destructing t1
---
Почему так:
• Поля инициализируются в порядке объявления в структуре, а не в списке инициализации • std::initializer_list создаёт временные объекты, которые копируются в вектор • t2 создаётся после строки Inside constructor • Деструкторы вызываются в обратном порядке: t2 → temp2 → temp1 → t1
Хитрость — в порядке инициализации, временных объектах и destructuring-порядке!
Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.
If riding a bucking bronco is your idea of fun, you’re going to love what the stock market has in store. Consider this past week’s ride a preview.The week’s action didn’t look like much, if you didn’t know better. The Dow Jones Industrial Average rose 213.12 points or 0.6%, while the S&P 500 advanced 0.5%, and the Nasdaq Composite ended little changed.